/* Copyright 2009
 *
 * This program and the accompanying materials
 * are made available under the terms of the
 * Eclipse Public License v1.0 which accompanies
 * this distribution, and is available at
 *
 * 		http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in
 * writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
 * OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * Contributors:
 * 	   IBM Corporation - initial API and implementation for JDT/DLTK
 *     Sean W. Quinn - initial adoption for use with PHP from various sources.
 */
package org.eclipse.php.core;

import org.eclipse.dltk.core.IType;

/**
 * Represents an entire binary type (single <code>.class</code> file). A class
 * file has a single child of type <code>IType</code>. Class file elements need
 * to be opened before they can be navigated. If a class file cannot be parsed,
 * its structure remains unknown. Use <code>IPHPElement.isStructureKnown</code>
 * to determine whether this is the case.
 * <p>
 * Note: <code>IClassFile</code> extends <code>ISourceReference</code>. Source
 * can be obtained for a class file if and only if source has been attached to
 * this class file. The source associated with a class file is the source code
 * of the compilation unit it was (nominally) generated from.
 * </p>
 * 
 * @noimplement This interface is not intended to be implemented by clients.
 */

public interface IScriptFile extends ITypeRoot {

	/**
	 * Returns the bytes contained in this class file.
	 * 
	 * @return the bytes contained in this class file
	 * 
	 * @exception PHPModelException
	 *                if this element does not exist or if an exception occurs
	 *                while accessing its corresponding resource
	 * @since 3.3
	 */
	byte[] getBytes() throws PHPModelException;

	/**
	 * Returns the type contained in this class file. This is a handle-only
	 * method. The type may or may not exist.
	 * 
	 * @return the type contained in this class file
	 */
	IType getType();

	/**
	 * Returns whether this type represents a class. This is not guaranteed to
	 * be instantaneous, as it may require parsing the underlying file.
	 * 
	 * @return <code>true</code> if the class file represents a class.
	 * 
	 * @exception PHPModelException
	 *                if this element does not exist or if an exception occurs
	 *                while accessing its corresponding resource
	 */
	boolean isClass() throws PHPModelException;

	/**
	 * Returns whether this type represents an interface. This is not guaranteed
	 * to be instantaneous, as it may require parsing the underlying file.
	 * 
	 * @return <code>true</code> if the class file represents an interface.
	 * 
	 * @exception PHPModelException
	 *                if this element does not exist or if an exception occurs
	 *                while accessing its corresponding resource
	 */
	boolean isInterface() throws PHPModelException;
}
